package com.dianping.cat.configuration.web.url.entity;

import com.dianping.cat.configuration.web.url.BaseEntity;
import com.dianping.cat.configuration.web.url.IVisitor;
import java.util.LinkedHashMap;
import java.util.Map;

public class UrlPattern
  extends BaseEntity<UrlPattern> {
/*  10 */   private Map<String, PatternItem> m_patternItems = new LinkedHashMap();

/*  12 */   private Map<Integer, Code> m_codes = new LinkedHashMap();






/*  19 */   public void accept(IVisitor visitor) { visitor.visitUrlPattern(this); }


  public UrlPattern addCode(Code code) {
/*  23 */     this.m_codes.put(code.getId(), code);
    return this;
  }

  public UrlPattern addPatternItem(PatternItem patternItem) {
/*  28 */     this.m_patternItems.put(patternItem.getName(), patternItem);
    return this;
  }


  public boolean equals(Object obj) {
/*  34 */     if (obj instanceof UrlPattern) {
/*  35 */       UrlPattern _o = (UrlPattern)obj;

/*  37 */       if (!equals(getPatternItems(), _o.getPatternItems())) {
/*  38 */         return false;
      }

/*  41 */       if (!equals(getCodes(), _o.getCodes())) {
/*  42 */         return false;
      }


/*  46 */       return true;
    }

/*  49 */     return false;
  }


/*  53 */   public Code findCode(Integer id) { return (Code)this.m_codes.get(id); }



/*  57 */   public PatternItem findPatternItem(String name) { return (PatternItem)this.m_patternItems.get(name); }


  public Code findOrCreateCode(Integer id) {
/*  61 */     Code code = (Code)this.m_codes.get(id);

/*  63 */     if (code == null) {
/*  64 */       synchronized (this.m_codes) {
/*  65 */         code = (Code)this.m_codes.get(id);

/*  67 */         if (code == null) {
/*  68 */           code = new Code(id);
/*  69 */           this.m_codes.put(id, code);
        }
      }
    }

/*  74 */     return code;
  }

  public PatternItem findOrCreatePatternItem(String name) {
    PatternItem patternItem = (PatternItem)this.m_patternItems.get(name);

/*  80 */     if (patternItem == null) {
/*  81 */       synchronized (this.m_patternItems) {
/*  82 */         patternItem = (PatternItem)this.m_patternItems.get(name);

/*  84 */         if (patternItem == null) {
/*  85 */           patternItem = new PatternItem(name);
/*  86 */           this.m_patternItems.put(name, patternItem);
        }
      }
    }

/*  91 */     return patternItem;
  }


/*  95 */   public Map<Integer, Code> getCodes() { return this.m_codes; }



/*  99 */   public Map<String, PatternItem> getPatternItems() { return this.m_patternItems; }






  public void mergeAttributes(UrlPattern other) {}



/* 117 */   public Code removeCode(Integer id) { return (Code)this.m_codes.remove(id); }



/* 121 */   public PatternItem removePatternItem(String name) { return (PatternItem)this.m_patternItems.remove(name); }
}


/* Location:              /Users/hanfei/Documents/apache-tomcat-9.0.24/webapps/cat/WEB-INF/lib/cat-core-3.0.0.jar!/com/dianping/cat/configuration/web/url/entity/UrlPattern.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       1.0.7
 */